//: Playground - noun: a place where people can play

import UIKit

//var tuple = ["10001", "zhangsan", ""]
//tuple[0]
//tuple[1]
//tuple[2]
//
//var tuple2 = ["10001", "zhangsan", 1.22] as [Any]
//tuple2[0]
//tuple2[1]
//tuple2[2]

var tuple = ("10001", "zhangsan", 1.88)
tuple.0
tuple.1
tuple.2

// 元组别名
var tuple1 = (id:"10001", name:"zhangsan", height:1.88)
tuple1.id
tuple1.name
tuple1.height

// 直接赋值
let (id, name, height) = ("10002", "lisi", 1.22);
id
name
height


func maxMin(numbers: Int ...) -> (max: Int, min: Int)? {
    if numbers.count == 0 {
        return nil;
    }
    var maxV = numbers.first, minV = numbers.first;
    for item in numbers {
        if item>maxV! {
            maxV = item;
        }
        
        if item<minV! {
            minV = item;
        }
    }
    return (maxV!, minV!);
}

